package com.loveprogrammer.eternity.skill.support.skills.properties;

import com.loveprogrammer.eternity.common.Tuple;
import com.loveprogrammer.eternity.model.Character;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName StrengthPropertySkill
 * @Description 永久力量技巧提升
 * @Author admin
 * @Date 2023/10/7 10:43
 * @Version 1.0
 */
public class StrengthPropertySkill extends AbstractPassivePropertySkill{
    int increment = 0;

    public StrengthPropertySkill(int id, int baseInterval, int level, int order, int maxLevel,
                                    String name, String desc) {
        super(id, baseInterval, level, order, maxLevel, name, desc);
    }

    @Override
    public boolean checkLevelUp(int characterLevel) {
        // 每4级升一级
        if (characterLevel % 4 == 0) {
            return true;
        }
        return false;
    }

    @Override
    protected Tuple<String, List<Character>> skillLaunch(Character character, List<? extends Character> attack, List<? extends Character> defences) {
        Tuple<String, List<Character>> result = new Tuple<>();
        // 基础力量按照百分比增加
        increment = character.getBaseStrength() * getHarm(character) / 100;
        character.setStrength(character.getStrength() + increment);
        result.setKey(character.getName() + "释放了技能【" + getName() + " (" + getLevel() + "级)】,自身力量提升" + increment + "点" );
        result.setValue(new ArrayList<>());
        return result;
    }

    @Override
    protected int computeHarm(Character character) {
        return 15 + getLevel() * 2;
    }

    @Override
    protected int computeSecondHarm(Character character) {
        return 0;
    }

    @Override
    public void release(Character character,List<? extends Character> attack, List<? extends Character> defences) {
        character.setStrength(character.getStrength() - increment);
    }
}
